import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
// import { composeWithDevTools } from 'redux-devtools-extension'
import rootReducer from './reducers'

let middlewares
if (process.env.NODE_ENV === 'production') {
  middlewares = applyMiddleware(thunk)
} else {
  const { composeWithDevTools } = require('redux-devtools-extension')
  middlewares = composeWithDevTools(applyMiddleware(thunk))
}
// 创建仓库
const store = createStore(rootReducer, middlewares)


export default store